import RenderAuthorized from '../components/Authorized';
import { getAuthority, } from './authority';

let Authorized = RenderAuthorized(getAuthority()); // eslint-disable-line
// Reload the rights component
const reloadAuthorized = () => {
  Authorized = RenderAuthorized(getAuthority());
};

const checkAuthority=(key)=>{
  let resources = localStorage.getItem('resource');
  if (resources) {
    return JSON.stringify(resources).indexOf(key) !== -1;
  }
  return false;
}

export { reloadAuthorized,checkAuthority };
export default Authorized;
